package org.qiaice.handler;

import lombok.extern.slf4j.Slf4j;
import org.qiaice.exception.BaseException;
import org.qiaice.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = BaseException.class)
    public Result<Object> exceptionHandler(BaseException e) {
        log.error("异常信息: {}", e.getMessage());
        return Result.no(e.getMessage());
    }
}
